/**
 * <copyright>
 * </copyright>
 *
 */
package org.xtext.example.mydsl.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.myDsl.Destino;
import org.xtext.example.mydsl.myDsl.MyDslPackage;
import org.xtext.example.mydsl.myDsl.Redireccionar;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Redireccionar</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.RedireccionarImpl#getDest1 <em>Dest1</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.RedireccionarImpl#getDest2 <em>Dest2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RedireccionarImpl extends AccionImpl implements Redireccionar
{
  /**
   * The cached value of the '{@link #getDest1() <em>Dest1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDest1()
   * @generated
   * @ordered
   */
  protected Destino dest1;

  /**
   * The cached value of the '{@link #getDest2() <em>Dest2</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDest2()
   * @generated
   * @ordered
   */
  protected Destino dest2;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected RedireccionarImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.REDIRECCIONAR;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Destino getDest1()
  {
    return dest1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetDest1(Destino newDest1, NotificationChain msgs)
  {
    Destino oldDest1 = dest1;
    dest1 = newDest1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.REDIRECCIONAR__DEST1, oldDest1, newDest1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDest1(Destino newDest1)
  {
    if (newDest1 != dest1)
    {
      NotificationChain msgs = null;
      if (dest1 != null)
        msgs = ((InternalEObject)dest1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.REDIRECCIONAR__DEST1, null, msgs);
      if (newDest1 != null)
        msgs = ((InternalEObject)newDest1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.REDIRECCIONAR__DEST1, null, msgs);
      msgs = basicSetDest1(newDest1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.REDIRECCIONAR__DEST1, newDest1, newDest1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Destino getDest2()
  {
    return dest2;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetDest2(Destino newDest2, NotificationChain msgs)
  {
    Destino oldDest2 = dest2;
    dest2 = newDest2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.REDIRECCIONAR__DEST2, oldDest2, newDest2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDest2(Destino newDest2)
  {
    if (newDest2 != dest2)
    {
      NotificationChain msgs = null;
      if (dest2 != null)
        msgs = ((InternalEObject)dest2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.REDIRECCIONAR__DEST2, null, msgs);
      if (newDest2 != null)
        msgs = ((InternalEObject)newDest2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.REDIRECCIONAR__DEST2, null, msgs);
      msgs = basicSetDest2(newDest2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.REDIRECCIONAR__DEST2, newDest2, newDest2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.REDIRECCIONAR__DEST1:
        return basicSetDest1(null, msgs);
      case MyDslPackage.REDIRECCIONAR__DEST2:
        return basicSetDest2(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.REDIRECCIONAR__DEST1:
        return getDest1();
      case MyDslPackage.REDIRECCIONAR__DEST2:
        return getDest2();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.REDIRECCIONAR__DEST1:
        setDest1((Destino)newValue);
        return;
      case MyDslPackage.REDIRECCIONAR__DEST2:
        setDest2((Destino)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.REDIRECCIONAR__DEST1:
        setDest1((Destino)null);
        return;
      case MyDslPackage.REDIRECCIONAR__DEST2:
        setDest2((Destino)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.REDIRECCIONAR__DEST1:
        return dest1 != null;
      case MyDslPackage.REDIRECCIONAR__DEST2:
        return dest2 != null;
    }
    return super.eIsSet(featureID);
  }

} //RedireccionarImpl
